
/****************************************************************************/
/*Copyright (c) 2011, Florent DEVILLE.                                      */
/*All rights reserved.                                                      */
/*                                                                          */
/*Redistribution and use in source and binary forms, with or without        */
/*modification, are permitted provided that the following conditions        */
/*are met:                                                                  */
/*                                                                          */
/* - Redistributions of source code must retain the above copyright         */
/*notice, this list of conditions and the following disclaimer.             */
/* - Redistributions in binary form must reproduce the above                */
/*copyright notice, this list of conditions and the following               */
/*disclaimer in the documentation and/or other materials provided           */
/*with the distribution.                                                    */
/* - The names of its contributors cannot be used to endorse or promote     */
/*products derived from this software without specific prior written        */
/*permission.                                                               */
/* - The source code cannot be used for commercial purposes without         */ 
/*its contributors' permission.                                             */
/*                                                                          */
/*THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/*"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/*LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS         */
/*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE            */
/*COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,       */
/*INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,      */
/*BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;          */
/*LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER          */
/*CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT        */
/*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN         */
/*ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE           */
/*POSSIBILITY OF SUCH DAMAGE.                                               */
/****************************************************************************/

#include "primitiveWidget.h"

#include <QPushButton>
#include <QLayout>
#include <QToolButton>
#include <QAction>

primitiveWidget::primitiveWidget(QWidget* parent)
{
	//QPixmap* spherePic = new QPixmap(".\\Resources\\sphere.bmp");

	_triangleButton = new QPushButton("Triangle");
	_triangleButton->setCheckable(true);


	_sphereButton = new QPushButton("Sphere");
	_sphereButton->setCheckable(true);

	_boxButton = new QPushButton("Box");
	_boxButton->setCheckable(true);
	_torusButton = new QPushButton("Torus");
	_torusButton->setCheckable(true);
	_cylinderButton = new QPushButton("Cylinder");
	_cylinderButton->setCheckable(true);
	_coneButton = new QPushButton("Cone");
	_coneButton->setCheckable(true);

	_cubeMeshButton = new QPushButton("Cube (mesh)");
	_cubeMeshButton->setCheckable(true);

	_planMeshButton = new QPushButton("Plan (mesh)");
	_planMeshButton->setCheckable(true);

	QGridLayout* grid = new QGridLayout();
	grid->addWidget(_sphereButton, 1, 0, 1, 1);
	grid->addWidget(_boxButton, 2, 0, 1, 1);
	grid->addWidget(_torusButton, 3, 0, 1, 1);
	grid->addWidget(_cylinderButton, 4, 0, 1, 1);
	grid->addWidget(_cubeMeshButton, 5, 0, 1, 1);
	grid->addWidget(_planMeshButton, 6, 0, 1, 1);
	grid->addWidget(new QWidget(), 7, 0, 1, 1);

	setLayout(grid);
}

primitiveWidget::~primitiveWidget()
{
}

//uncheck all the buttons
void primitiveWidget::unCheckAll()
{
	_triangleButton->setChecked(false);
	_sphereButton->setChecked(false);
	_boxButton->setChecked(false);
	_torusButton->setChecked(false);
	_cylinderButton->setChecked(false);
	_coneButton->setChecked(false);
	_cubeMeshButton->setChecked(false);
	_planMeshButton->setChecked(false);
}

//check the triangle button
void primitiveWidget::CheckButtonTriangle()
{
	_triangleButton->setChecked(true);
}

//check the sphere button
void primitiveWidget::CheckButtonSphere()
{
	_sphereButton->setChecked(true);
}

//check the box button
void primitiveWidget::CheckButtonBox()
{
	_boxButton->setChecked(true);
}

//check the torus button
void primitiveWidget::CheckButtonTorus()
{
	_torusButton->setChecked(true);
}

//check the cylinder button
void primitiveWidget::CheckButtonCylinder()
{
	_cylinderButton->setChecked(true);
}

//check the cone button
void primitiveWidget::CheckButtonCone()
{
	_coneButton->setChecked(true);
}

//check the cube mesh button
void primitiveWidget::CheckCubeMeshButton()
{
	_cubeMeshButton->setChecked(true);
}

//check the plan mesh button
void primitiveWidget::CheckPlanMeshButton()
{
	_planMeshButton->setChecked(true);
}